package com.cuijq.ms.emailbridge.v1;

/**
 * @author by CuiJQ
 * @Classname ErrorAlertHandler
 * @Description ErrorAlertHandler Description
 * @Date 2021/5/26 15:09
 */
public class ErrorAlertHandler extends AlertHandler {

  AlertRule rule;
  Notification notification;

  public ErrorAlertHandler(AlertRule rule, Notification notification) {
    super(rule, notification);
  }

  @Override
  public void check(ApiStatInfo apiStatInfo) {
    if (apiStatInfo.getErrorCount() > rule.getMatchedRule(apiStatInfo.getApi()).getMaxErrorCount()) {
      notification.notify(NotificationEmergencyLevel.SEVERE, "...");
    }
  }
}
